{extend name='public/base' /}
{block name="css"}

{/block}
{block name="content"}
<div class="ibox xiaoshi">
    <div class="ibox-content">
        <div class="row">
            <div class="col-sm-12">
                <div class="row">
                    <form class="form-inline" id="form">
                        <div class="col-sm-3">
                            <div class="input-group">
                                <div class="input-group-btn">
                                    <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">删除时间</button>
                                </div>
                                <input type="text"  class="form-control range_time"  placeholder="选择时间" name="time"/>
                            </div>
                        </div>

                        <div class="col-sm-3">
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </div>

                    </form>
                </div>

            </div>

        </div>

    </div>
</div>


<div class="row">
    <div class="col-sm-12">
        <div class="ibox">
            <div class="ibox-content">
                <div class="btn-group-sm" id="toolbar" role="group">
                    <a class="btn btn-success  btn-rounded multiple" onclick="$.form.recycleAll()">
                        <i class="fa fa-repeat"></i> 恢复
                    </a>

                    <a class="btn btn-danger btn-rounded multiple " onclick="$.form.removeAll()">
                        <i class="fa fa-remove"></i> 真实删除
                    </a>

                </div>
                <div class="table-striped">
                    <table id="bootstrap-table" ></table>
                </div>
            </div>
        </div>
    </div>
</div>

{/block}

{block name="js"} <!--js处理区-->

<script>
    $(function() {
        var options = {
            url: "{:url('recycle')}",
            deleteUrl:  "{:url('deltrue')}?id={id}", //删除链接
            exportUrl:  "",  //导出
            updateUrl: "", //编辑
            addUrl:    "", //添加
            recycleUrl:  "{:url('recycleData')}",    //恢复
            sortName: "id",
            sortOrder: "desc",
            modalName: "回收站",
            clickToSelect: false,
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: 'ID'
                },
                {
                    field: 'title',
                    title: '文章标题',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,50,'open');
                    }
                },
                {
                    field: 'keywords',
                    title: '关键词',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,40,'open');
                    }
                },
                {
                    field: 'author',
                    title: '作者'
                },
                {
                    field: 'origin',
                    title: '来源'
                },
                {
                    field: 'is_top',
                    title: '置顶',
                    formatter: function(value, row, index) {
                        if(value==0){
                            return '<span class="badge badge-primary">否</span>';
                        }else {
                            return '<span class="badge badge-warning">是</span>';
                        }
                    }
                },
                {
                    field: 'is_show',
                    title: '是否显示',
                    formatter: function(value, row, index) {
                        if(value==0){
                            return '<span class="badge badge-warning">不展示</span>';
                        }else {
                            return '<span class="badge badge-info">展示</span>';
                        }
                    }
                },
                {
                    field: 'is_recommend',
                    title: '是否推荐',
                    formatter: function(value, row, index) {
                        if(value==0){
                            return '<span class="badge badge-danger">不推荐</span>';
                        }else {
                            return '<span class="badge badge-info">推荐</span>';
                        }
                    }
                },
                {
                    field: 'delete_time',
                    title: '删除时间',
                    sortable: true,
                    formatter: function(value, row, index) {
                            return $.common.timeToTime(value,2);
                    }
                },
                {
                    field: 'create_time',
                    title: '添加时间',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return edit_del(row);
                    }

                }]
        };
        $.table.init(options);
    });

    function edit_del(row) {
        var actions = [];
        actions.push('<a class="btn btn-danger btn-xs" data-original-title="删除" data-toggle="tooltip" onclick="$.form.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i></a>');
        return actions;
    }




</script>

{/block}
